UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vuMmF76eRdF09fVsf3P+7n0swe9EG2+MY6JDp9mjKIs='
WHERE
key_id = 'f580ff12300a54c06b0987903c16d5e9f407c5d3ec1a2f12ea5c989ce6e2d9f6'
AND (
token = 'vuMmF76eRdF09fVsf3P+7n0swe9EG2+MY6JDp9mjKIs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)