UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aGhLY0cjBKdQtqUe75sSvika8NJMLkZgrZagSJsgGNA=' 
WHERE 
  key_id = '2a249022227ef53c31477df7cdd6e695b8a30186ce06f2fc1e69ea4b3ca365f3' 
  AND (
    token = 'aGhLY0cjBKdQtqUe75sSvika8NJMLkZgrZagSJsgGNA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050