UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SmqORIbt2JHwPmA3DluPgVJV6yB5Jjj8WmwvoiFpN8o=' 
WHERE 
  key_id = '9891e3c1716613cd02d844b3601d868de8980f6185e0549a982dd48031790a14' 
  AND (
    token = 'SmqORIbt2JHwPmA3DluPgVJV6yB5Jjj8WmwvoiFpN8o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045