UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VW/7SivcP2hJdq4+WwEzzv2i2vATe637t1XozkhcE30=' 
WHERE 
  key_id = '23c8de8dba58062fea8b47c3d99951d77c1015a79723b5ece4951dbedc3c8e7c' 
  AND (
    token = 'VW/7SivcP2hJdq4+WwEzzv2i2vATe637t1XozkhcE30=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056