UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IY6vDfQrNk6fJbpnhSwEKYf47EjiKWhWM2br+K7R7sg=' 
WHERE 
  key_id = '0d9f23e15fd99d175cb3c4c433a2159ab633116c2036eb793898cf9a87bda790' 
  AND (
    token = 'IY6vDfQrNk6fJbpnhSwEKYf47EjiKWhWM2br+K7R7sg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036