UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XDaqVRAO02Ny6VeNu1NEC/ZvHbDUhq+ZSEyvAdqfleU=' 
WHERE 
  key_id = '1c695d7debc87f17acc1a02bffe99bbe087ec1edad04a0b779ff81b7145ebab4' 
  AND (
    token = 'XDaqVRAO02Ny6VeNu1NEC/ZvHbDUhq+ZSEyvAdqfleU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017