UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A05wV1Z6+nIDFgAeFUJ3SBIa8utlNKi60zg9pi9Lbqw=' 
WHERE 
  key_id = '837de9d19162c9a68c4b9d9155659178a50ec742a570846c144a8d3dc7c021e0' 
  AND (
    token = 'A05wV1Z6+nIDFgAeFUJ3SBIa8utlNKi60zg9pi9Lbqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041