UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+e7Q0B3Fa3UOAjoRBN/yr7kPxhU9huS1jqNuGe0Kz/o=' 
WHERE 
  key_id = '0ca90c9258b33de809f294608f7ce801884092eac81008936f66d9536e110edd' 
  AND (
    token = '+e7Q0B3Fa3UOAjoRBN/yr7kPxhU9huS1jqNuGe0Kz/o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046