UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KT2jkeb7l/0vOq/lq+gRGIE/0TO5SriQIevg2i+0+N4='
WHERE
key_id = '51d0f78bbdcc93ef394b8ea94fc81090db1164a5f201cda6c66bc8acb763a977'
AND (
token = 'KT2jkeb7l/0vOq/lq+gRGIE/0TO5SriQIevg2i+0+N4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)