UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SfjB94CxIB5FE5nRt1ozU9x/Ld5UiT4yoE9O23aseXA='
WHERE
key_id = 'dc8e02c3fa80af3b7c245ed8a1a031cf200aed9857a7df139e6b3664dd19204f'
AND (
token = 'SfjB94CxIB5FE5nRt1ozU9x/Ld5UiT4yoE9O23aseXA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)