UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B9kBLpn6uaRVMJYY5u+kTwaJp5UsA8kHD17GE5L6GP8='
WHERE
key_id = '7b140e7f4446659a1dad282275403fd32d02b67f4565718e16e0a5fd3d6d6f12'
AND (
token = 'B9kBLpn6uaRVMJYY5u+kTwaJp5UsA8kHD17GE5L6GP8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)