UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ny2YZetjA0feukmyj5PhAHcP0GOl36LU1a12VrNua1M=' 
WHERE 
  key_id = 'f4ea15165959a535f975bd3bb9affcc6682623e19704350bc1617236f084c651' 
  AND (
    token = 'Ny2YZetjA0feukmyj5PhAHcP0GOl36LU1a12VrNua1M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030