UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1qe/46f8hkScTBIUG8sTKmj+obt2VrpKerVmtCg/xvw=' 
WHERE 
  key_id = '76e4e947d54a632d40ed7fde944a2aeb3b8df38901e4f4cbf2b2dfd319199d44' 
  AND (
    token = '1qe/46f8hkScTBIUG8sTKmj+obt2VrpKerVmtCg/xvw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045