UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'toXj/LESwTQf2yzMoj0e6CAe4Iw6X7LxmXUtva2eB7Q=' 
WHERE 
  key_id = 'ce98e734d31720820dde164513e675e68325c9799b44f819a9cb4f8fe7ed5735' 
  AND (
    token = 'toXj/LESwTQf2yzMoj0e6CAe4Iw6X7LxmXUtva2eB7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053