UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iwAIy415V6v+/RxrYoamOUCdtJPYb9SR3sLgE8x+9hU=' 
WHERE 
  key_id = '082100d45aa745b6aeea62645bdb281054be5c91b0604626f6b0d2169eb2582e' 
  AND (
    token = 'iwAIy415V6v+/RxrYoamOUCdtJPYb9SR3sLgE8x+9hU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047