UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NMhh2vJhQZ4kE4rKvbK4RiwKSEAhq6X5SWt/mS2Ogys='
WHERE
key_id = 'e2684d06063833a24a1b47962d8e2c635994a44b46be1ca5104ad530df077858'
AND (
token = 'NMhh2vJhQZ4kE4rKvbK4RiwKSEAhq6X5SWt/mS2Ogys='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)