UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iv/3X4vy/r437UcIj74PgDOZ+SiQ+jRIfOFATRLTCNc=' 
WHERE 
  key_id = '598eb2b7ea62953d2590e49f535a75b0022e854b848f38bbe3800d1f5c0826ac' 
  AND (
    token = 'iv/3X4vy/r437UcIj74PgDOZ+SiQ+jRIfOFATRLTCNc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018