UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fp5Jlrxjsv+hLV6cBA9sDpFNO2JFh16oqaowjt0l0NI=' 
WHERE 
  key_id = '79d59a01857231f185f3e06a5894f93c42377eb07bf54cefd9a7820e3e272ed5' 
  AND (
    token = 'fp5Jlrxjsv+hLV6cBA9sDpFNO2JFh16oqaowjt0l0NI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031