UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o19h93s0cQzrDKUt07jvA4H1GnMcnTODBxxuPKbGqc0=' 
WHERE 
  key_id = '03309d66bbc6a9ac7b0b916a0e67789d1b89ce5588c43648968073d89689cc36' 
  AND (
    token = 'o19h93s0cQzrDKUt07jvA4H1GnMcnTODBxxuPKbGqc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023