UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aQs0WHJK6bpiJuc8u4x8AAGK/2mcAZdfBH52F2vigUo='
WHERE
key_id = 'd950361cc3c622de69e867b8e99981cc14ca7391c3531144915900462c1cdc75'
AND (
token = 'aQs0WHJK6bpiJuc8u4x8AAGK/2mcAZdfBH52F2vigUo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)