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