UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jq0z+6C1Ap3xbxorFQBZ7ABDYfenzdwA6XJYCvl8A1I=' 
WHERE 
  key_id = '2537d4af150b370ed01aece0601807c94afbd3a7e7b2cceb3d98edf061223442' 
  AND (
    token = 'Jq0z+6C1Ap3xbxorFQBZ7ABDYfenzdwA6XJYCvl8A1I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031