UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BbrZYPQ6fgxVDjQgyxttj9YB9Qbz7GnOzMaViCksYLE='
WHERE
key_id = '566e1430635b299b567eb1ca48f87c154a2bbe12ffaf5171b257ed625542262f'
AND (
token = 'BbrZYPQ6fgxVDjQgyxttj9YB9Qbz7GnOzMaViCksYLE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)