UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n4ErxyA68xNXOacQIYZBrTj1oWkiMEc42qen0JOO3Jc=' 
WHERE 
  key_id = '4ea9165ffbe9c38cf1f58a69c9875de908447050a94205d76a0941451355b372' 
  AND (
    token = 'n4ErxyA68xNXOacQIYZBrTj1oWkiMEc42qen0JOO3Jc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032