UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dt2Va2fi55JAzMPqc6WfjfT0ArvYd+owISNyCwD610s=' 
WHERE 
  key_id = '5b9a4d02339bff01cca76df160c2f3cd1c40c9d630718dfb7354abf0f80891b6' 
  AND (
    token = 'dt2Va2fi55JAzMPqc6WfjfT0ArvYd+owISNyCwD610s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029