UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fn5tVUe+bP5cxt4ja7/Y2Vczne1bqev3yfaKCV6HyuU='
WHERE
key_id = 'a7d5d539af053f215bd86d5c8440d65817d7c32084b56c01d673d28f3387f5db'
AND (
token = 'fn5tVUe+bP5cxt4ja7/Y2Vczne1bqev3yfaKCV6HyuU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)