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