UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6Iq8iCpGwp2lmHMDc7R3EnupiAxVkUYp6cT+JDJjGm8=' 
WHERE 
  key_id = '42d377c94299bcf17199823336732c263abf87854131ddc05bde54c7cb3f0850' 
  AND (
    token = '6Iq8iCpGwp2lmHMDc7R3EnupiAxVkUYp6cT+JDJjGm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047