UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '27rebFjalyeKioCDIhNbX6cTwOUsX19VNnmyBRR1kpk='
WHERE
key_id = '3120f6ba15de53b815a9c98d3fcb61658b8202e690cea1338c500ee03035e1d0'
AND (
token = '27rebFjalyeKioCDIhNbX6cTwOUsX19VNnmyBRR1kpk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)