UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p1B0sniKf+ltHvfMxYsRAV2mSqfvVkp4HQimvy0jW38='
WHERE
key_id = 'bbc5ce1ed60469bead65fd46be92df656fa5f72b384eb0c17b7831666fcfe3df'
AND (
token = 'p1B0sniKf+ltHvfMxYsRAV2mSqfvVkp4HQimvy0jW38='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)