UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D43M/xFVQd+wQdwVOAYkuhMCbz21HUP8MI0+fopI5MY='
WHERE
key_id = 'ad9aa0d04bfe56c2302ac7e8242293369d6e30f5c516616333f082f1cc64f1b3'
AND (
token = 'D43M/xFVQd+wQdwVOAYkuhMCbz21HUP8MI0+fopI5MY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)