UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mwhzt3vqa2rGl072/0rhi+PrVLd5OK0fzJjoendcjjI='
WHERE
key_id = '0f7a993c148a8e6bd3dbc1375335e581544b410d3b475dbdcf46e5c29392019c'
AND (
token = 'mwhzt3vqa2rGl072/0rhi+PrVLd5OK0fzJjoendcjjI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)