UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YjEKL6imbq7hPfeievLz/hMd7DdqHbDQJEqThH5ifrE=' 
WHERE 
  key_id = '2c0662425f5719d9bf6519a843b87d4582cd49de327ab8298828e5f44cc57ce6' 
  AND (
    token = 'YjEKL6imbq7hPfeievLz/hMd7DdqHbDQJEqThH5ifrE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038