UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'StpUJ6lMN9+ZCb0a1uYAyPnQbsltAgPZ1WBqvMLdSKE='
WHERE
key_id = 'c4a43ba7693ec4509e1a1b05542854f218f5feff7b15056a5b7d46d08594c62a'
AND (
token = 'StpUJ6lMN9+ZCb0a1uYAyPnQbsltAgPZ1WBqvMLdSKE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)