UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BbP+8aQZuEj9zYnYvjFy4n6KcTEZ9aywvDAVM8LyWZE='
WHERE
key_id = 'fdca45372cbad1080f455163f35cf7b69dd79af1813549fa845cee53ad2498d5'
AND (
token = 'BbP+8aQZuEj9zYnYvjFy4n6KcTEZ9aywvDAVM8LyWZE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)