UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ndC9OfmzBbjULiDfwIal7DXtmdibQXJ9zzdsFNW4ak4='
WHERE
key_id = 'c5f53dd3ec8d0be7517e8cefeae2002bf5444764c2ef4f36838df42d31460a10'
AND (
token = 'ndC9OfmzBbjULiDfwIal7DXtmdibQXJ9zzdsFNW4ak4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)