UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JudNzlvP64hFI+KqNa6DO+3p7CRt7cnRp2Nswj5vF8k=' 
WHERE 
  key_id = '71ed78ebf0412423f3430760df0addaa703e93d0053a8709298f1e410bd73949' 
  AND (
    token = 'JudNzlvP64hFI+KqNa6DO+3p7CRt7cnRp2Nswj5vF8k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020