UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7QAx5exk9TnV+C1TOD2yhr3lwYmZUOOCvQprktG99tI=' 
WHERE 
  key_id = '55ea52334a4e62084ceace120bb6506a31bf0aff869404d37b0d589dfad95113' 
  AND (
    token = '7QAx5exk9TnV+C1TOD2yhr3lwYmZUOOCvQprktG99tI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050