UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iVcT7RpyTUSuEGjFCNnEUGPE+GjJR13mSruCwBbCkY8=' 
WHERE 
  key_id = '8b1e0b9b30d08733f3345ea088dc505eb007046b19d20bb6c2dd87a915c5573f' 
  AND (
    token = 'iVcT7RpyTUSuEGjFCNnEUGPE+GjJR13mSruCwBbCkY8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055