UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'di+pdpx6IjW4iLWm2okFALzdFpiC8TDtu+K5+GVYR64=' 
WHERE 
  key_id = '4daf8a3b75dd56cfca182666b3fe7d3001fe51c580253fdd1a812732e9b312d8' 
  AND (
    token = 'di+pdpx6IjW4iLWm2okFALzdFpiC8TDtu+K5+GVYR64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042