UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '46XJxmW4Jxs+ztspfdqqHdpRRn3r9mcl97sH392EbHA=' 
WHERE 
  key_id = '3711dad569f139447e9ed6730f0c094ee8a817cb1b1c8a83c7aa628de6741f92' 
  AND (
    token = '46XJxmW4Jxs+ztspfdqqHdpRRn3r9mcl97sH392EbHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043