UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gvxNCQbc+4velterriFCTr7zdXI0JcLfbF+H5U6FSxU='
WHERE
key_id = 'bc946fcae428e5c3cb556a5972eacde9b28ecf3b653cceb1f66791f584b35fe3'
AND (
token = 'gvxNCQbc+4velterriFCTr7zdXI0JcLfbF+H5U6FSxU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)