UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u+v5RaSJs/VFElWDdRFscwRNZZNJxRvoOepmG3U95OA='
WHERE
key_id = '59304f16c99b8c6e07d1cc560259625611fd0b779267f142322545d4bd3c5298'
AND (
token = 'u+v5RaSJs/VFElWDdRFscwRNZZNJxRvoOepmG3U95OA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)