UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oFD9VdkgyMt6wbIntPp48NlH7yi6zAZD34fiOI8/UEY='
WHERE
key_id = 'bfad9e929d1223fdcd32d8d577397ac9c8f014edd8da320b2b0f972c710ccd41'
AND (
token = 'oFD9VdkgyMt6wbIntPp48NlH7yi6zAZD34fiOI8/UEY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)